/** @jsxImportSource @emotion/react */
import {
  BlobInputList, Button, CCell, Cell, Input, InputDatalist, InputLine, LineColumn, SuffixInput, Table, TableBody, TableHead, TableRow, Text
} from "customize-easy-ui-component";
import * as React from "react";
import {InspectRecordLayout, InternalItemProps, RepLink, SelectInput, useItemInputControl} from "../../common/base";
import {calcAverageArrObj, floatInterception, tableSetInp} from "../../../common/tool";
import {useMeasureInpFilter} from "../../common/hooks";
import {检查结论选} from "../../tools";
import {css} from "@emotion/react";
import {天气选, 路面选} from "./Speed";

export const tail爬坡度= <Text css={{"@media print": {fontSize: '0.875rem'}}}>
  注：1、蓄电池叉车运行电动机电流应不大于S2=5min工作制电流。<br/>
  2、液力传动、静压传动的叉车速度不低于2km/h。
</Text>;
const itemA爬坡度= ['天气爬坡','温度爬坡','风速爬坡','湿度爬坡','路面爬坡', '爬坡表','爬坡速度','电机电流','爬坡r'] as string[];
const itemM爬坡= ['爬坡测',] as string[];
//零星的测量项目 o/v + 直接合并用于验证存储重名。
export const itemn爬坡 =itemM爬坡.concat(itemA爬坡度);
const itemAm=itemA爬坡度.concat('满最爬坡','工制电流');
export const Climbability=
    React.forwardRef((
        { children, show ,alone=true,redId,nestMd,label,}:InternalItemProps,  ref
    ) => {
      const [getInpFilter]=useMeasureInpFilter(itemM爬坡,itemAm,);
      const {inp, setInp} = useItemInputControl({ ref });
      const avsped=Number(calcAverageArrObj(inp?.爬坡表,(row)=>row?.s, 1,3)) || '';
      const avcirc=Number(calcAverageArrObj(inp?.爬坡表,(row)=>row?.c, 1,3)) || '';
      //若上【useEffect】会依赖循环的！
      const doCalcSpeed = React.useCallback(() => {
        inp?.爬坡表?.forEach((r:any, t: number) => {
          const speed =floatInterception(r?.l/r?.t, 2) || 0;
          if(speed)  tableSetInp('爬坡表', t, inp, setInp, 's', speed)
        });
      }, [inp?.爬坡表,inp,setInp]);
      return <InspectRecordLayout inp={inp} setInp={setInp} getInpFilter={getInpFilter} show={show} redId={redId}
                                  nestMd={nestMd} alone={alone} label={label!}>
        <Text variant="h5">{label}：</Text>
        试验条件：
        <div css={{display: 'flex', flexWrap: 'wrap', alignItems: 'center',justifyContent:'center'}}>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
              天气:
                <BlobInputList value={inp?.天气爬坡 || ''} rows={1} datalist={天气选}
                           style={{display: 'inline-flex', width: '5rem', maxWidth: '100%', fontSize: '1rem',}}
                           listStyle={css({fontSize: '1rem',})}
                           onListChange={v => setInp({...inp, 天气爬坡: v || undefined})}/>
            </div>
            <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
              温度：
              <Input value={inp?.温度爬坡 || ''} size={2} style={{display: 'inline-flex', width: 'unset'}}
                      onChange={e => setInp({...inp, 温度爬坡: e.currentTarget.value || undefined}) }/>
              ℃；
            </div>
            <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
              最大风速：
                <Input value={inp?.风速爬坡 || ''}  size={2} style={{display: 'inline-flex', width: 'unset'}}
                       onChange={e => setInp({...inp, 风速爬坡: e.currentTarget.value || undefined}) }/>
              m/s；
            </div>
            <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            空气最大相对湿度:
                  <Input value={inp?.湿度爬坡 || ''}  size={2} style={{display: 'inline-flex', width: 'unset'}}
                          onChange={e => setInp({...inp, 湿度爬坡: e.currentTarget.value || undefined}) }/>
            %；
            </div>
            <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
              试验路面类型：
                <BlobInputList value={inp?.路面爬坡 || ''} rows={1} datalist={路面选}
                               style={{display: 'inline-flex', width: '19rem', maxWidth: '100%', fontSize: '1rem',}}
                               listStyle={css({fontSize: '1rem',})}
                               onListChange={v => setInp({...inp, 路面爬坡: v || undefined})}/>
            </div>
        </div>
        <hr/>
        <LineColumn column={6}>
          <div css={{margin: 'auto'}}>爬坡度设计值： {inp?.满最爬坡}（%）</div>
          <InputLine label='爬坡度-实测值'>
            <SuffixInput value={inp?.爬坡测o || ''}
                         onChange={e => setInp({...inp, 爬坡测o: e.currentTarget.value || undefined})}>%</SuffixInput>
          </InputLine>
          <InputLine label='爬坡度-试验结果'>
            <SuffixInput value={inp?.爬坡测v || ''}
                         onChange={e => setInp({...inp, 爬坡测v: e.currentTarget.value || undefined})}>%</SuffixInput>
          </InputLine>
        </LineColumn>
        <LineColumn column={8}>
          {(new Array(3).fill(null)).map((_, t: number) => {
            return <React.Fragment key={t}>
              <InputLine label={`${t+1}次测量距离`}>
                <SuffixInput value={inp?.爬坡表?.[t]?.l || ''}
                             onChange={e => tableSetInp('爬坡表', t, inp, setInp, 'l', e.currentTarget.value || undefined)}>m</SuffixInput>
              </InputLine>
              <InputLine label={`${t+1}次测量时间`}>
                <SuffixInput value={inp?.爬坡表?.[t]?.t || ''}
                             onChange={e => tableSetInp('爬坡表', t, inp, setInp, 't', e.currentTarget.value || undefined)}>s</SuffixInput>
              </InputLine>
              <InputLine label={`${t+1}次爬坡速度`}>
                <SuffixInput value={inp?.爬坡表?.[t]?.s || ''}
                             onChange={e => tableSetInp('爬坡表', t, inp, setInp, 's', e.currentTarget.value || undefined)}>km/h</SuffixInput>
              </InputLine>
              <InputLine label={`${t+1}次电机电流`}>
                <SuffixInput value={inp?.爬坡表?.[t]?.c || ''}
                             onChange={e => tableSetInp('爬坡表', t, inp, setInp, 'c', e.currentTarget.value || undefined)}>A</SuffixInput>
              </InputLine>
            </React.Fragment>;
          })}
        </LineColumn>
        <Button intent='primary' onPress={() => doCalcSpeed()}>修改距离和时间之后，需计算速度值</Button>
        <br/>平均速度={avsped}（km/h）；&nbsp; 平均电机电流={avcirc}（A）；
        <LineColumn column={6}>
          <div css={{margin: 'auto'}}>5min工作制电流： {inp?.工制电流} （A）</div>
          <InputLine label='爬坡速度-试验结果'>
            <SuffixInput value={inp?.爬坡速度 || ''}
                         onChange={e => setInp({...inp, 爬坡速度: e.currentTarget.value || undefined})}>mm</SuffixInput>
          </InputLine>
          <InputLine label='电动机电流-试验结果'>
            <SuffixInput value={inp?.电机电流 || ''}
                         onChange={e => setInp({...inp, 电机电流: e.currentTarget.value || undefined})}>mm</SuffixInput>
          </InputLine>
          <InputLine label='爬坡-结果判定'>
            <SelectInput value={inp?.爬坡r || ''} list={检查结论选}
                         onChange={e => setInp({...inp, 爬坡r: e.currentTarget.value || undefined})}/>
          </InputLine>
        </LineColumn>
        {tail爬坡度}
    </InspectRecordLayout>;
});
//附表7-1 满载最大爬坡
export const ClimbabilityVw = ({orc, rep, label,}: { orc: any, rep: any, label: string }
) => {
  const avsped=Number(calcAverageArrObj(orc?.爬坡表,(row)=>row?.s, 1,3)) || '';
  const avcirc=Number(calcAverageArrObj(orc?.爬坡表,(row)=>row?.c, 1,3)) || '';
  return <>
    <div css={{"@media print": {paddingBottom: '9rem', pageBreakInside: 'avoid'}}}>
      <Text id='Climbability' variant="h4" css={{marginTop: '1rem',
      }}>{label}</Text>
      试验条件：天气:{orc?.天气爬坡} &nbsp;温度：{orc?.温度爬坡} ℃ 最大风速：{orc?.风速爬坡} m/s 空气最大相对湿度: {orc?.湿度爬坡}%；
      <div css={{display: 'inline-flex'}}>试验路面类型：{orc?.路面爬坡}</div>
    </div>
    <Table fixed={ ["3.2%", "6.5%", "7.9%", "12%", "12%", "13%", "%", "12%","10%",  "14%"] }
                    css={{borderCollapse: 'collapse', "@media print": {marginTop: '-9rem'}}} tight miniw={800}>
      <TableHead>
        <TableRow>
          <CCell rowSpan={2}>序号</CCell><CCell colSpan={2}>爬坡度（%）</CCell><CCell rowSpan={2}>测量距离（m）</CCell><CCell rowSpan={2}>测量时间（s）</CCell>
          <CCell colSpan={2}>爬坡速度（km/h）</CCell><CCell colSpan={3}>电动机电流（A）</CCell>
        </TableRow>
        <TableRow>
          <CCell>设计值</CCell><CCell>实测值</CCell><CCell>实测值</CCell><CCell>平均值</CCell>
          <CCell>实测值</CCell><CCell>平均值</CCell><CCell><Text css={{fontSize:'0.75rem'}}>5min工作制电流</Text></CCell>
        </TableRow>
      </TableHead>
      <TableBody>
        <RepLink ori rep={rep} tag={'Climbability'}>
          {(new Array(3).fill(null)).map((_,t:number) => {
            return <TableRow key={t}>
              <CCell>{t+1}</CCell>
              {0===t && <><CCell rowSpan={3}>{orc?.满最爬坡}</CCell><CCell rowSpan={3}>{orc?.爬坡测o}</CCell>
              </>}
              <CCell>{orc?.爬坡表?.[t]?.l}</CCell><CCell>{orc?.爬坡表?.[t]?.t}</CCell><CCell>{orc?.爬坡表?.[t]?.s}</CCell>
              {0===t &&<CCell rowSpan={3}>{avsped}</CCell>}
              <CCell>{orc?.爬坡表?.[t]?.c}</CCell>
              {0===t && <><CCell rowSpan={3}>{avcirc}</CCell><CCell rowSpan={3}>{orc?.工制电流}</CCell>
              </>}
            </TableRow>;
          })}
          <TableRow>
            <CCell colSpan={2}>试验结果</CCell><CCell>{orc?.爬坡测v}</CCell><CCell colSpan={2}>-</CCell>
            <CCell colSpan={2}>{orc?.爬坡速度}</CCell><CCell colSpan={3}>{orc?.电机电流}</CCell>
          </TableRow>
          <TableRow>
            <CCell colSpan={2}>结果判定</CCell><CCell colSpan={8}>{orc?.爬坡r}</CCell>
          </TableRow>
          <TableRow>
            <Cell colSpan={10} css={{whiteSpace: 'pre-wrap'}}>{tail爬坡度}</Cell>
          </TableRow>
        </RepLink>
      </TableBody>
    </Table>
  </>;
};

/*其它类似页面
* */
export const tail牵引力= <Text css={{"@media print": {fontSize: '0.875rem'}}}>
  注：1、液力以及静压传动车辆按照2.0km/h时测得的牵引力为其最大牵引力；机械传动的车辆在最小稳定车速下测得的牵引力为其最大牵引力。<br/>
  2、由最大牵引力折算的最大爬坡度应≥设计值。<br/>
  3、由最大牵引力折算的最大爬坡度：α<sub>m</sub> =tan[arcsin(1000Fm / 9.8G<sub>0</sub>）]×100 %。
</Text>;
const 方向s= ['正','反' ];
export const itemA牵引力= ['天气牵引','温度牵引','风速牵引','湿度牵引','路面牵引', '牵引力表','牵引力r','坡度牵v','叉总质量'] as string[];
const itemA牵引m=itemA牵引力.concat('满最爬坡', );
export const TractionForce=
    React.forwardRef((
        { children, show ,alone=true,redId,nestMd,label,}:InternalItemProps,  ref
    ) => {
      const [getInpFilter]=useMeasureInpFilter(null,itemA牵引m,);
      const {inp, setInp} = useItemInputControl({ ref });
      const avfor=Number(calcAverageArrObj(inp?.牵引力表,(row)=>row?.F, 2,2)) || 0;
      const ratio = (1000 * avfor) / (9.8 * inp?.叉总质量);
      const arcsinValue = Math.asin(ratio);
      const eqclimb =floatInterception(100 * Math.tan(arcsinValue), 1);
      return <InspectRecordLayout inp={inp} setInp={setInp} getInpFilter={getInpFilter} show={show} redId={redId}
                                  nestMd={nestMd} alone={alone} label={label!}>
        <Text variant="h5">{label}：</Text>
        试验条件：
        <div css={{display: 'flex', flexWrap: 'wrap', alignItems: 'center',justifyContent:'center'}}>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            天气:
            <BlobInputList value={inp?.天气牵引 || ''} rows={1} datalist={天气选}
                           style={{display: 'inline-flex', width: '5rem', maxWidth: '100%', fontSize: '1rem',}}
                           listStyle={css({fontSize: '1rem',})}
                           onListChange={v => setInp({...inp, 天气牵引: v || undefined})}/>
          </div>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            温度：
            <Input value={inp?.温度牵引 || ''} size={2} style={{display: 'inline-flex', width: 'unset'}}
                   onChange={e => setInp({...inp, 温度牵引: e.currentTarget.value || undefined}) }/>
            ℃；
          </div>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            最大风速：
            <Input value={inp?.风速牵引 || ''}  size={2} style={{display: 'inline-flex', width: 'unset'}}
                   onChange={e => setInp({...inp, 风速牵引: e.currentTarget.value || undefined}) }/>
            m/s；
          </div>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            空气最大相对湿度:
            <Input value={inp?.湿度牵引 || ''}  size={2} style={{display: 'inline-flex', width: 'unset'}}
                   onChange={e => setInp({...inp, 湿度牵引: e.currentTarget.value || undefined}) }/>
            %；
          </div>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            试验路面类型：
            <BlobInputList value={inp?.路面牵引 || ''} rows={1} datalist={路面选}
                           style={{display: 'inline-flex', width: '19rem', maxWidth: '100%', fontSize: '1rem',}}
                           listStyle={css({fontSize: '1rem',})}
                           onListChange={v => setInp({...inp, 路面牵引: v || undefined})}/>
          </div>
        </div>
        <hr/>
        <LineColumn>
          {方向s.map((fxian, t: number) => {
            return <React.Fragment key={t}>
              <InputLine label={`${fxian}-行驶方向牵引力`}>
                <SuffixInput value={inp?.牵引力表?.[t]?.F || ''}
                             onChange={e => tableSetInp('牵引力表', t, inp, setInp, 'F', e.currentTarget.value || undefined)}>kN</SuffixInput>
              </InputLine>
            </React.Fragment>;
          })}
        </LineColumn>
        最大牵引力Fm 平均值={avfor} （kN）；
        <LineColumn column={6}>
          <div css={{margin: 'auto'}}>爬坡度设计值： {inp?.满最爬坡}（%）</div>
          <InputLine label='叉车总质量G0'>
            <SuffixInput value={inp?.叉总质量 || ''}
                         onChange={e => setInp({...inp, 叉总质量: e.currentTarget.value || undefined})}>kg</SuffixInput>
          </InputLine>
          <div css={{margin: 'auto'}}>坡度折算值： {eqclimb || ''} （%）</div>
        </LineColumn>
        <LineColumn>
          <InputLine label='坡度（%）-结果'>
            <SuffixInput value={inp?.坡度牵v || ''}
                         onChange={e => setInp({...inp, 坡度牵v: e.currentTarget.value || undefined})}>%</SuffixInput>
          </InputLine>
          <InputLine label='附表7-2最大牵引力-结果判定'>
            <SelectInput value={inp?.牵引力r || ''} list={检查结论选}
                         onChange={e => setInp({...inp, 牵引力r: e.currentTarget.value || undefined})}/>
          </InputLine>
        </LineColumn>
        {tail牵引力}
    </InspectRecordLayout>;
  });
//附表7-2 最大牵引力试验
export const TractionForceVw = ({orc, rep, label,}: { orc: any, rep: any, label: string }
) => {
  const avfor=Number(calcAverageArrObj(orc?.牵引力表,(row)=>row?.F, 2,2)) || 0;
  const ratio = (1000 * avfor) / (9.8 * orc?.叉总质量);
  const arcsinValue = Math.asin(ratio);
  const eqclimb =floatInterception(100 * Math.tan(arcsinValue), 1);
  return <>
    <div css={{"@media print": {paddingBottom: '7rem', pageBreakInside: 'avoid'}}}>
      <Text id='TractionForce' variant="h4" css={{marginTop: '1rem',
      }}>{label}</Text>
      试验条件：天气:{orc?.天气牵引} &nbsp;温度：{orc?.温度牵引} ℃ 最大风速：{orc?.风速牵引} m/s 空气最大相对湿度: {orc?.湿度牵引}%；
      <div css={{display: 'inline-flex'}}>试验路面类型：{orc?.路面牵引}</div>
    </div>
    <Table fixed={ ["9%",  "14%", "13%", "16%", "12%", "%", "12%","12%"] }
           css={{borderCollapse: 'collapse', "@media print": {marginTop: '-7rem'}}} tight miniw={800}>
      <TableHead>
        <TableRow>
          <CCell rowSpan={2}>行驶方向</CCell><CCell colSpan={2}>最大牵引力Fm（kN）</CCell>
          <CCell rowSpan={2}>叉车总质量G0（kg）</CCell><CCell colSpan={3}>坡度（%）</CCell><CCell rowSpan={2}>结果判定</CCell>
        </TableRow>
        <TableRow>
          <CCell>实测值</CCell><CCell>平均值</CCell><CCell>设计值</CCell><CCell>折算值</CCell><CCell>结果</CCell>
        </TableRow>
      </TableHead>
      <TableBody>
        <RepLink ori rep={rep} tag={'TractionForce'}>
          {方向s.map((fxian, t: number) => {
            return <TableRow key={t}>
              <CCell>{fxian}</CCell>
              <CCell>{orc?.牵引力表?.[t]?.F}</CCell>
              {0 === t && <>
                <CCell rowSpan={2}>{avfor}</CCell><CCell rowSpan={2}>{orc?.叉总质量}</CCell><CCell rowSpan={2}>{orc?.满最爬坡}</CCell>
                <CCell rowSpan={2}>{eqclimb || ''}</CCell><CCell rowSpan={2}>{orc?.坡度牵v}</CCell><CCell rowSpan={2}>{orc?.牵引力r}</CCell>
              </>}
            </TableRow>;
          })}
          <TableRow>
            <Cell colSpan={8} css={{whiteSpace: 'pre-wrap'}}>{tail牵引力}</Cell>
          </TableRow>
        </RepLink>
      </TableBody>
    </Table>
  </>;
};

/*其它类似页面
* */
export const tail挂钩牵= <Text css={{"@media print": {fontSize: '0.875rem'}}}>
  注：最大挂钩牵引力应≥设计值。
</Text>;
//预防需求多样? 采用不同的：'叉总质量'字段,还是需改成不同的字段 '叉总质挂'。
export const itemA挂钩牵= ['天气挂钩','温度挂钩','风速挂钩','湿度挂钩','路面挂钩', '挂钩力表','挂钩力r','挂钩牵v','叉总质挂'] as string[];
const itemA挂钩m=itemA挂钩牵.concat('满最牵力', );
export const HookTraction=
    React.forwardRef((
        { children, show ,alone=true,redId,nestMd,label,}:InternalItemProps,  ref
    ) => {
      const [getInpFilter]=useMeasureInpFilter(null,itemA挂钩m,);
      const {inp, setInp} = useItemInputControl({ ref });
      const avfor=Number(calcAverageArrObj(inp?.挂钩力表,(row)=>row?.F, 2,2)) || 0;
      return <InspectRecordLayout inp={inp} setInp={setInp} getInpFilter={getInpFilter} show={show} redId={redId}
                                  nestMd={nestMd} alone={alone} label={label!}>
        <Text variant="h5">{label}：</Text>
        试验条件：
        <div css={{display: 'flex', flexWrap: 'wrap', alignItems: 'center',justifyContent:'center'}}>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            天气:
            <BlobInputList value={inp?.天气挂钩 || ''} rows={1} datalist={天气选}
                           style={{display: 'inline-flex', width: '5rem', maxWidth: '100%', fontSize: '1rem',}}
                           listStyle={css({fontSize: '1rem',})}
                           onListChange={v => setInp({...inp, 天气挂钩: v || undefined})}/>
          </div>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            温度：
            <Input value={inp?.温度挂钩 || ''} size={2} style={{display: 'inline-flex', width: 'unset'}}
                   onChange={e => setInp({...inp, 温度挂钩: e.currentTarget.value || undefined}) }/>
            ℃；
          </div>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            最大风速：
            <Input value={inp?.风速挂钩 || ''}  size={2} style={{display: 'inline-flex', width: 'unset'}}
                   onChange={e => setInp({...inp, 风速挂钩: e.currentTarget.value || undefined}) }/>
            m/s；
          </div>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            空气最大相对湿度:
            <Input value={inp?.湿度挂钩 || ''}  size={2} style={{display: 'inline-flex', width: 'unset'}}
                   onChange={e => setInp({...inp, 湿度挂钩: e.currentTarget.value || undefined}) }/>
            %；
          </div>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            试验路面类型：
            <BlobInputList value={inp?.路面挂钩 || ''} rows={1} datalist={路面选}
                           style={{display: 'inline-flex', width: '19rem', maxWidth: '100%', fontSize: '1rem',}}
                           listStyle={css({fontSize: '1rem',})}
                           onListChange={v => setInp({...inp, 路面挂钩: v || undefined})}/>
          </div>
        </div>
        <hr/>
        按行驶方向，各4个项目录入：
        <LineColumn>
          {方向s.map((fxian, t: number) => {
            return <React.Fragment key={t}>
              <InputLine label={`${fxian}向-发动机熄火`}>
                <InputDatalist value={inp?.挂钩力表?.[t]?.x || ''}  datalist={['有','无']}
                               onListChange={v => tableSetInp('挂钩力表', t, inp, setInp, 'x', v || undefined)} />
              </InputLine>
              <InputLine label={`${fxian}向-轮胎滑转`}>
                <InputDatalist value={inp?.挂钩力表?.[t]?.f || ''}  datalist={['有','无']}
                               onListChange={v => tableSetInp('挂钩力表', t, inp, setInp, 'f', v || undefined)} />
              </InputLine>
              <InputLine label={`${fxian}向-变矩器失速`}>
                <InputDatalist value={inp?.挂钩力表?.[t]?.S || ''}  datalist={['有','无']}
                               onListChange={v => tableSetInp('挂钩力表', t, inp, setInp, 'S', v || undefined)} />
              </InputLine>
              <InputLine label={`${fxian}-最大挂钩牵引力`}>
                <SuffixInput value={inp?.挂钩力表?.[t]?.F || ''}
                             onChange={e => tableSetInp('挂钩力表', t, inp, setInp, 'F', e.currentTarget.value || undefined)}>kN</SuffixInput>
              </InputLine>
            </React.Fragment>
          })}
        </LineColumn>
        最大挂钩牵引力 平均值={avfor} （kN）；
        <LineColumn column={6}>
          <div css={{margin: 'auto'}}>最大挂钩牵引力-设计值={inp?.满最牵力}（kN）</div>
          <InputLine label='叉车总质量G0'>
            <SuffixInput value={inp?.叉总质挂 || ''}
                         onChange={e => setInp({...inp, 叉总质挂: e.currentTarget.value || undefined})}>kg</SuffixInput>
          </InputLine>
        </LineColumn>
        <LineColumn>
          <InputLine label='最大挂钩牵引力-试验结果'>
            <SuffixInput value={inp?.挂钩牵v || ''}
                         onChange={e => setInp({...inp, 挂钩牵v: e.currentTarget.value || undefined})}>kN</SuffixInput>
          </InputLine>
          <InputLine label='附表8最大挂钩牵引力-结果判定'>
            <SelectInput value={inp?.挂钩力r || ''} list={检查结论选}
                         onChange={e => setInp({...inp, 挂钩力r: e.currentTarget.value || undefined})}/>
          </InputLine>
        </LineColumn>
        {tail挂钩牵}
    </InspectRecordLayout>;
  });
//附表8 最大挂钩牵引力(内燃
export const HookTractionVw = ({orc, rep, label,}: { orc: any, rep: any, label: string }
) => {
  const avfor=Number(calcAverageArrObj(orc?.挂钩力表,(row)=>row?.F, 2,2)) || 0;
  return <>
    <div css={{"@media print": {paddingBottom: '7rem', pageBreakInside: 'avoid'}}}>
      <Text id='HookTraction' variant="h4" css={{marginTop: '1rem',
      }}>{label}</Text>
      试验条件：天气:{orc?.天气挂钩} &nbsp;温度：{orc?.温度挂钩} ℃ 最大风速：{orc?.风速挂钩} m/s 空气最大相对湿度: {orc?.湿度挂钩}%；
      <div css={{display: 'inline-flex'}}>试验路面类型：{orc?.路面挂钩}</div>
    </div>
    <Table fixed={ ["8.1%",  "10%", "12%", "12%", "12%", "%", "9%","9%", "8.5%", "7%"] }
           css={{borderCollapse: 'collapse', "@media print": {marginTop: '-7rem'}}} tight miniw={800}>
      <TableHead>
        <TableRow>
          <CCell rowSpan={2}>行驶方向</CCell><CCell rowSpan={2}>叉车总质量G0(kg)</CCell><CCell colSpan={3}>特征</CCell>
          <CCell colSpan={4}>最大挂钩牵引力（kN）</CCell><CCell rowSpan={2}>结果判定</CCell>
        </TableRow>
        <TableRow>
          <CCell>发动机熄火</CCell><CCell>轮胎滑转</CCell><CCell>变矩器失速</CCell>
          <CCell>实测值</CCell><CCell>平均值</CCell><CCell>设计值</CCell><CCell>试验结果</CCell>
        </TableRow>
      </TableHead>
      <TableBody>
        <RepLink ori rep={rep} tag={'HookTraction'}>
          {方向s.map((fxian, t: number) => {
            return <TableRow key={t}>
              <CCell>{fxian}</CCell>
              {0 === t && <CCell rowSpan={2}>{orc?.叉总质挂}</CCell>}
              <CCell>{orc?.挂钩力表?.[t]?.x}</CCell><CCell>{orc?.挂钩力表?.[t]?.f}</CCell><CCell>{orc?.挂钩力表?.[t]?.S}</CCell><CCell>{orc?.挂钩力表?.[t]?.F}</CCell>
              {0 === t && <>
                <CCell rowSpan={2}>{avfor}</CCell><CCell rowSpan={2}>{orc?.满最牵力}</CCell>
                <CCell rowSpan={2}>{orc?.挂钩牵v}</CCell><CCell rowSpan={2}>{orc?.挂钩力r}</CCell>
              </>}
            </TableRow>
          })}
          <TableRow>
            <Cell colSpan={10} css={{whiteSpace: 'pre-wrap'}}>{tail挂钩牵}</Cell>
          </TableRow>
        </RepLink>
      </TableBody>
    </Table>
  </>;
};
/*最后一组页面
* */
export const tail电动叉= <Text css={{"@media print": {fontSize: '0.875rem'}}}>
  注：1、电动叉车牵引力在电动机电流为S2=5min工作制下最大允许电流时测得。<br/>
  2、由最大牵引力折算的最大爬坡度应≥设计值。<br/>
  3、由最大牵引力折算的最大爬坡度：α<sub>m</sub> =tan[arcsin(1000Fm / 9.8G<sub>0</sub>）]×100 %。
</Text>;
const 工况s= ['去程','回程' ];
//'叉总质量' 改名 '叉总质电'
export const itemA电动叉= ['天气电叉','温度电叉','风速电叉','湿度电叉','路面电叉', '电叉力表','电叉牵r','电叉坡r','电叉牵v','电叉坡v','叉总质电'] as string[];
const itemA电动叉m=itemA电动叉.concat('满最牵力','工制电流','满最爬坡' );
export const ElectricTract=
    React.forwardRef((
        { children, show ,alone=true,redId,nestMd,label,}:InternalItemProps,  ref
    ) => {
      const [getInpFilter]=useMeasureInpFilter(null,itemA电动叉m,);
      const {inp, setInp} = useItemInputControl({ ref });
      const avfor=Number(calcAverageArrObj(inp?.电叉力表,(row)=>row?.F, 2,2)) || 0;
      const ratio = (1000 * avfor) / (9.8 * inp?.叉总质电);
      const arcsinValue = Math.asin(ratio);
      const eqclimb =floatInterception(100 * Math.tan(arcsinValue), 1);
      return <InspectRecordLayout inp={inp} setInp={setInp} getInpFilter={getInpFilter} show={show} redId={redId}
                                  nestMd={nestMd} alone={alone} label={label!}>
        <Text variant="h5">{label}：</Text>
        试验条件：
        <div css={{display: 'flex', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center'}}>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            天气:
            <BlobInputList value={inp?.天气电叉 || ''} rows={1} datalist={天气选}
                           style={{display: 'inline-flex', width: '5rem', maxWidth: '100%', fontSize: '1rem',}}
                           listStyle={css({fontSize: '1rem',})}
                           onListChange={v => setInp({...inp, 天气电叉: v || undefined})}/>
          </div>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            温度：
            <Input value={inp?.温度电叉 || ''} size={2} style={{display: 'inline-flex', width: 'unset'}}
                   onChange={e => setInp({...inp, 温度电叉: e.currentTarget.value || undefined})}/>
            ℃；
          </div>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            最大风速：
            <Input value={inp?.风速电叉 || ''} size={2} style={{display: 'inline-flex', width: 'unset'}}
                   onChange={e => setInp({...inp, 风速电叉: e.currentTarget.value || undefined})}/>
            m/s；
          </div>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            空气最大相对湿度:
            <Input value={inp?.湿度电叉 || ''} size={2} style={{display: 'inline-flex', width: 'unset'}}
                   onChange={e => setInp({...inp, 湿度电叉: e.currentTarget.value || undefined})}/>
            %；
          </div>
          <div css={{display: 'inline-flex', alignItems: 'center', flexWrap: 'wrap'}}>
            试验路面类型：
            <BlobInputList value={inp?.路面电叉 || ''} rows={1} datalist={路面选}
                           style={{display: 'inline-flex', width: '19rem', maxWidth: '100%', fontSize: '1rem',}}
                           listStyle={css({fontSize: '1rem',})}
                           onListChange={v => setInp({...inp, 路面电叉: v || undefined})}/>
          </div>
        </div>
        <hr/>
        <LineColumn>
          {工况s.map((fxian, t: number) => {
            return <React.Fragment key={t}>
              <InputLine label={`${fxian}-电动机电流`}>
                <SuffixInput value={inp?.电叉力表?.[t]?.c || ''}
                             onChange={e => tableSetInp('电叉力表', t, inp, setInp, 'c', e.currentTarget.value || undefined)}>A</SuffixInput>
              </InputLine>
              <InputLine label={`${fxian}-最大挂钩牵引力Fm实测值`}>
                <SuffixInput value={inp?.电叉力表?.[t]?.F || ''}
                             onChange={e => tableSetInp('电叉力表', t, inp, setInp, 'F', e.currentTarget.value || undefined)}>kN</SuffixInput>
              </InputLine>
            </React.Fragment>;
          })}
        </LineColumn>
        5min工作制电流= {inp?.工制电流} A; <br/>
        最大挂钩牵引力Fm 平均值={avfor} （kN）； &nbsp; 最大挂钩牵引力Fm 设计值= {inp?.满最牵力} kN;
        <LineColumn>
          <InputLine label='最大挂钩牵引力Fm-试验结果'>
            <SuffixInput value={inp?.电叉牵v || ''}
                         onChange={e => setInp({...inp, 电叉牵v: e.currentTarget.value || undefined})}>%</SuffixInput>
          </InputLine>
          <InputLine label='最大挂钩牵引力Fm-C3.4.2结果判定'>
            <SelectInput value={inp?.电叉牵r || ''} list={检查结论选}
                         onChange={e => setInp({...inp, 电叉牵r: e.currentTarget.value || undefined})}/>
          </InputLine>
        </LineColumn>
        <hr/>
        <LineColumn>
          <InputLine label='叉车总质量G0'>
            <SuffixInput value={inp?.叉总质电 || ''}
                         onChange={e => setInp({...inp, 叉总质电: e.currentTarget.value || undefined})}>kg</SuffixInput>
          </InputLine>
          <div css={{margin: 'auto'}}>坡度折算值： {eqclimb || ''} （%）</div>
          <div css={{margin: 'auto'}}>最大挂钩牵引力折算的最大爬坡度设计值： {inp?.满最爬坡}（%）</div>
        </LineColumn>
        <LineColumn>
          <InputLine label='最大挂钩牵引力折算的最大爬坡度-结果'>
            <SuffixInput value={inp?.电叉坡v || ''}
                         onChange={e => setInp({...inp, 电叉坡v: e.currentTarget.value || undefined})}>%</SuffixInput>
          </InputLine>
          <InputLine label='挂钩牵引力折算最大爬坡C3.4.1结果判定'>
            <SelectInput value={inp?.电叉坡r || ''} list={检查结论选}
                         onChange={e => setInp({...inp, 电叉坡r: e.currentTarget.value || undefined})}/>
          </InputLine>
        </LineColumn>
        {tail电动叉}
    </InspectRecordLayout>;
});
//附表9 最大牵引力、最大挂钩牵(电动叉车
export const ElectricTractVw = ({orc, rep, label,}: { orc: any, rep: any, label: string }
) => {
  const avfor=Number(calcAverageArrObj(orc?.电叉力表,(row)=>row?.F, 2,2)) || 0;
  const ratio = (1000 * avfor) / (9.8 * orc?.叉总质电);
  const arcsinValue = Math.asin(ratio);
  const eqclimb =floatInterception(100 * Math.tan(arcsinValue), 1);
  return <>
    <div css={{"@media print": {paddingBottom: '6.5rem', pageBreakInside: 'avoid'}}}>
      <Text id='ElectricTract' variant="h5" css={{marginTop: '1rem',
      }}>{label}</Text>
      试验条件：天气:{orc?.天气电叉} &nbsp;温度：{orc?.温度电叉} ℃ 最大风速：{orc?.风速电叉} m/s 空气最大相对湿度: {orc?.湿度电叉}%；
      <div css={{display: 'inline-flex'}}>试验路面类型：{orc?.路面电叉}</div>
    </div>
    <Table fixed={ ["8.1%",  "11%", "12%","15%", "14%", "12%", "%", "10%","8%"] }
                 css={{borderCollapse: 'collapse', "@media print": {marginTop: '-6.5rem'}}} tight miniw={800}>
      <TableHead>
        <TableRow>
          <CCell rowSpan={2}>试验工况</CCell><CCell rowSpan={2}>叉车总质量G0(kg)</CCell><CCell colSpan={2}>电动机电流（A）</CCell>
          <CCell colSpan={4}>最大挂钩牵引力Fm（kN）（C3.4.2）</CCell><CCell rowSpan={2}>结果判定</CCell>
        </TableRow>
        <TableRow>
          <CCell>实测值</CCell><CCell>5min工作制电流</CCell>
          <CCell>实测值</CCell><CCell>平均值</CCell><CCell>设计值</CCell><CCell>试验结果</CCell>
        </TableRow>
      </TableHead>
      <TableBody>
        <RepLink ori rep={rep} tag={'ElectricTract'}>
          {工况s.map((fxian, t: number) => {
            return <TableRow key={t}>
              <CCell>{fxian}</CCell>
              {0 === t && <CCell rowSpan={2}>{orc?.叉总质电}</CCell>}
              <CCell>{orc?.电叉力表?.[t]?.c}</CCell>
              {0 === t && <CCell rowSpan={2}>{orc?.工制电流}</CCell>}
              <CCell>{orc?.电叉力表?.[t]?.F}</CCell>
              {0 === t && <>
                <CCell rowSpan={2}>{avfor}</CCell><CCell rowSpan={2}>{orc?.满最牵力}</CCell>
                <CCell rowSpan={2}>{orc?.电叉牵v}</CCell><CCell rowSpan={2}>{orc?.电叉牵r}</CCell>
              </>}
            </TableRow>
          })}
        </RepLink>
      </TableBody>
    </Table>
    <Table fixed={ ["25%", "28%", "%", "20%"] } css={{borderCollapse: 'collapse', }} tight miniw={800}>
      <TableHead>
        <TableRow><CCell colSpan={4}>最大挂钩牵引力折算的最大爬坡度（%）（C3.4.1）</CCell></TableRow>
        <TableRow><CCell>折算值</CCell><CCell>设计值</CCell><CCell>结果</CCell><CCell>结果判定</CCell></TableRow>
      </TableHead>
      <TableBody>
        <RepLink ori rep={rep} tag={'ElectricTract'}>
          <TableRow>
            <CCell>{eqclimb || ''}</CCell><CCell>{orc?.满最爬坡}</CCell><CCell>{orc?.电叉坡v}</CCell><CCell>{orc?.电叉坡r}</CCell>
          </TableRow>
          <TableRow>
            <Cell colSpan={4} css={{whiteSpace: 'pre-wrap'}}>{tail电动叉}</Cell>
          </TableRow>
        </RepLink>
      </TableBody>
    </Table>
  </>;
};
